<template>
	<view class="apps">
		<view class="bg">
			<image src="/static/top.png" mode="widthFix"></image>
			<view class="title">欢迎光临</view>
			<view class="author">Copyright <text class="font32" @click="showAuth">©2025</text> 融合体育 ICP备10011451号</view>
		</view>
		<uv-popup ref="popup" mode="center" :closeable="true" :close-on-click-overlay="false">
			<view class="verify">
			<view class="top">输入验证码</view>
			<uv-code-input v-model="value" @change="change" @finish="finish" :maxlength="4"></uv-code-input>
			</view>
		</uv-popup>
		<uv-popup ref="verifypup" mode="center" :closeable="true" :close-on-click-overlay="false">
			<view class="verifydata">
				<view class="top">核验信息</view>
				<view class="datalist">
					<view class="rlt" v-if="msg == '核验成功'">核验成功</view>
					<view class="rlt1" v-if="msg == '重复核验'">重复核验</view>
					<view class="item">
						<view class="f1">
							预留手机
						</view>
						<view class="f1">
							{{data.mobile}}
						</view>
					</view>
					<view class="item">
						<view class="f1">
							领取时间
						</view>
						<view class="f1">
							{{data.pull_time}}
						</view>
					</view>
					<view class="item">
						<view class="f1">
							核验时间：
						</view>
						<view class="f1">
							{{data.verify_time}}
						</view>
					</view>
					
				</view>
			</view>
		</uv-popup>
	</view>
</template>
<script>
	let app;
	export default {
		data() {
			return {
				value:'',
				verify:'',
				data:{},
				msg:'',
			}
		},
		onLoad(opt) {
			this.verify = opt.verify;
			app = this;

		},
		methods: {
			showAuth(){
				app.value='';
				app.$refs.popup.open();
			},
			change(e) {
				
			},
			finish(e) {
				app.$refs.popup.close();
				const arr = ['7758','5203','5581']
				if(arr.some(element => element === e) ){
				
					if(!!app.verify){
						app.request({
							url:'/verify',
							data:{code:app.verify},
							load:true,
							loadText:'验证中',
							success:function(rlt){
								app.msg = rlt.msg;
								if(rlt.code == 200){
									app.data = rlt.data;
									app.$refs.verifypup.open();
								}else{
									uni.showToast({
										title:rlt.msg,
										icon:"error"
									})
								}
							}
						})
					}else{
						uni.showToast({
							title:'查无此票',
							icon:"error"
						})
					}
					
				}else{
					uni.showToast({
						title:'验证码错误',
						icon:"error"
					})
					
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.bg{box-sizing:border-box;display:flex; flex-direction: column; padding:20rpx;  max-width: 100%; min-height: 100vh;background-image: url('/author/static/bg.jpg'); background-position:center center;background-size:cover; background-repeat: no-repeat;}
	.bg image{width:400rpx;}
	.bg .title{font-size: 120rpx; color:#fff; display: flex; align-items: center; justify-content: center;}
	.bg .author{font-size: 16px;color:#000; position: fixed;  bottom:50px; left: 0; right:0;text-align: center;}
	.font32{font-size: 18px; margin: 0 10rpx;}
	.verify{padding:20rpx;background-color: #fff;}
	.verify .top{padding:20rpx 10rpx; font-size: 16px;}
	.verifydata{width:720rpx;min-height: 200rpx;}
	.verifydata .top{padding:20rpx 10rpx; font-size: 16px;color:#0068ec}
	.datalist{display: flex; flex-direction: column;}
	.datalist .rlt{display: flex; align-items: center; justify-content: center;padding:20rpx 10rpx; font-size: 16px; font-weight: 400; color:#0068ec;}
	.datalist .rlt1{display: flex; align-items: center; justify-content: center;padding:20rpx 10rpx; font-size: 16px; font-weight: 400; color:#ec1535;}
	.datalist .item{display: flex; align-items: center;padding:15rpx;}
	.datalist .item .f1{flex:1;display:flex;}
</style>
